// https://nuxt.com/docs/api/configuration/nuxt-config
const baseUrl = process.env.NODE_ENV === 'production' ? '' : 'http://192.168.0.107:7091'
export default defineNuxtConfig({
  ssr: true,
  components: true,
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  // nitro: {
  //   devProxy: {
  //     '/api': {
  //       target: 'http://192.168.0.106:7091',
  //       changeOrigin: true,
  //       prependPath: true,
  //     }
  //   }
  // },
  postcss: {
    plugins: {
      tailwindcss: {},
      autoprefixer: {},
    },
  },

  elementPlus: {
    defaultLocale: 'zh-cn',
  },
  runtimeConfig: {
    baseUrl: baseUrl, // 开发环境使用本地后端,
    public: {
      baseUrl: baseUrl, // 开发环境使用本地后端,
    },
  },
  vite: {
    css: {
      preprocessorOptions: {
        scss: { api: 'modern-compiler' },
      }
    }
  },
  css: [
    '~/assets/css/tailwind.css',
    '~/assets/css/main.scss',  // 添加全局样式文件
    'element-plus/dist/index.css',
  ],
  imports: {
    dirs: [
      "stores/**/index.{ts,js,mjs,mts}",
    ]
  },
  modules: [
    // ...
    '@pinia/nuxt',
    '@element-plus/nuxt',
  ],
  typescript: {
    typeCheck: true,
    tsConfig: {
      compilerOptions: {
        types: ['./types']  // 添加类型声明文件路径
      }
    }
  },
})

